package org.gaaidou.ptarmigan.springboot.consistency;

//@Getter
//@Setter
public class Consistency {
//    private String txId;
//    private Date lastUpdateTime;
//    private int retryCount;
//    private ConsistencyState consistencyState;
//    private Function<String, ConsistencyState> syncFn;
//    private Function<String, ConsistencyState> startFn;
//    private BiConsumer<String, ConsistencyState> completeFn;
//    private ConsistencyHelper consistencyHelper;
//
//    Consistency(String txId, ConsistencyHelper consistencyHelper) {
//        this.txId = txId;
//        this.consistencyHelper = consistencyHelper;
//    }
//
//    public Consistency start(Function<String, ConsistencyState> startFn) {
//        this.startFn = startFn;
//        return this;
//    }
//
//    public Consistency sync(Function<String, ConsistencyState> syncFn) {
//        this.syncFn = syncFn;
//        this.consistencyState = ConsistencyState.DOING;
//        this.retryCount = 0;
//        this.lastUpdateTime = new Date();
//        return this;
//    }
//
//    public Consistency complete(BiConsumer<String, ConsistencyState> completeFn) {
//        this.completeFn = completeFn;
//        return this;
//    }
//
//    public void submit() {
//        ConsistencyState currState = this.startFn.apply(this.txId);
//        if (ConsistencyState.DOING.equals(currState)) {
//            consistencyHelper.submit(this);
//        }
//    }
}
